<%-- 
    Document   : updateinfo
    Created on : Apr 5, 2012, 9:44:15 PM
    Author     : Vishwakarma
--%>

<%@include file="header.jsp" %>

<%@page import="jobportal.Dbconn"%>
<%@page import="java.sql.*" %>
<%          Connection con=null;
            Statement st=null;
            String username=(String)session.getAttribute("username");
                String name = "", gender = "", dob = "", state = "", city = "", nationality = "", address = "", mobno = "", email = "";
            try {
                con = Dbconn.getConn();
                st = con.createStatement();
                ResultSet rs;
                
                String sql="select * from student where username='"+username+"'";
                rs=st.executeQuery(sql);
                if(rs.next()){
                    name=rs.getString("name");
                    gender=rs.getString("gender");
                    dob=rs.getString("dob");
                    state=rs.getString("state");
                    city=rs.getString("city");
                    nationality=rs.getString("nationality");
                    address=rs.getString("address");
                    mobno=rs.getString("contact");
                    email=rs.getString("email");

                }
           

%>



<span class="mainheading_js">My Personal Information </span><img src="../images/blank.gif" alt="blank" width="18" height="17" border="0" /><br>
<div class="sde_mnu_hdr_blue" style="text-align:center">
  <%if(request.getAttribute("status")!=null){out.println(request.getAttribute("status"));
						request.removeAttribute("status");}%>
</div>
<br>
<span class="messagesred">
</span>
<script>
$(document).ready(function(){
    $("#updatestuinfo").validationEngine();
    $('#dob').datepicker({
            changeMonth:true,
            changeYear:true,
            yearRange:'1950:1994',
            dateFormat: 'yy-mm-dd',
            inline:true

        });
        
         $('#state').change(function(e){
            $this = $(e.target);
            
            $.ajax({
                type: "POST",
                url: "../src/loadcity.jsp", 
                data: "state="+$this.val(),
                success:function(data){
                    $('#city').html(data);
                }
            });
        });
   });
</script>
<form name="updatestuinfo" id="updatestuinfo" action="updateinfo" method="post">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbl_bdr">
                    <tr>
                        <td colspan="5" align="left" valign="middle" class="sde_mnu_hdr_blue"><img src="../images/top_left.gif"; class="sde_mnu_img2" style="margin-left:3px; margin-top:3px;"/>Edit Information </td>
                    </tr>
                    <tr>
                        <td width="5%" height="28" align="center" class="messagesred">*</td>
                        <td width="25%" height="28" align="left" valign="middle" >Name</td>
                        <td width="4%" height="28" align="center" >:</td>
                        <td width="66%" height="28" colspan="2" align="left" valign="middle" >
                            <input name="name" class="validate[required] textbox" id="name" value="<%=name%>"  style="width:155px;"/>        </td>
                    </tr>
                    <tr>
                        <td height="28" align="center" class="messagesred">*</td>
                        <td height="28" align="left" valign="middle" >Gender</td>
                        <td height="28" align="center" >:</td>
                      <td height="28" colspan="2" align="left" valign="middle" >
                            <select name="title" id="title" class="validate[required] listmenu">
							<option value="<%=gender%>" selected="selected"><%=gender%></option>
							<%if(gender.equalsIgnoreCase("female")){%>
                                <option value="Male">Male</option>
                                <%}else{%>
								<option value="Female" >Female</option>
								<%}%>
                            </select></td>
                    </tr>
                    <tr>
                        <td align="center" class="messagesred">*</td>
                        <td height="28" align="left" valign="middle" >Date of Birth</td>
                        <td align="center" >:</td>
                        <td colspan="2" align="left" valign="middle" >
                            <input type="text" name="dob" id="dob" class="validate[required] textbox" value="<%=dob%>" readonly/></td>
                    </tr>
<tr>
                        <td align="center" class="messagesred">*</td>
                        <td height="28" align="left" valign="middle" >Nationality</td>
                        <td align="center" >:</td>
                        <td colspan="2" align="left" valign="middle" >
                            <input type="text" name="nationality" id="nationality" class="validate[required]" value="<%=nationality%>"  style="width:120px;"/></td>
              </tr>
                    <tr>
                        <td align="center" class="messagesred">*</td>
                        <td height="28" align="left" valign="middle" >State</td>
                        <td align="center" >&nbsp;</td>
                        <td colspan="2" align="left" valign="middle" >
                        <select name="state" id="state"  >
                          <option value="<%=state%>" selected="selected" ><%=state%></option>
                          <%
                                            Statement st1 = con.createStatement();
                                            ResultSet rs1 = st1.executeQuery("select distinct(state) FROM dist where state!='" + state + "'");
                                            while (rs1.next()) {
                                                out.println("<option value=\"" + rs1.getString(1) + "\">" + rs1.getString(1) + "</option>");
                                            }
                                        %>
                        </select></td>
                    </tr>
                    <tr>
                        <td align="center" class="messagesred">*</td>
                        <td height="28" align="left" valign="middle" >City</td>
                        <td align="center" >:</td>
                        <td colspan="2" align="left" valign="middle" >
                        
                        <select name="city" id="city" >
							<option value="<%=city%>" selected="selected"><%=city%></option>
                           <%
                                               
                                                 rs1 = st1.executeQuery("select district from dist where state='" + state + "' and district !='" + city + "'");
                                                while (rs1.next()) {
                                                    out.println("<option value=\"" + rs1.getString(1) + "\">" + rs1.getString(1) + "</option>");
                                                }
                                            %>
                            </select>                        </td>
                    </tr>
                    <tr>
                    <tr>
                        <td align="center" class="messagesred">&nbsp;</td>
                        <td height="28" align="left" valign="middle" >Current Address</td>
                        <td align="center" >:</td>
                        <td colspan="2" align="left" valign="middle" >
                            <textarea name="address" cols="50" rows="5" class="validate[required] selbox" id="address" ><%=address%></textarea>       </td>
                    </tr>

                    <tr>
                        <td align="center" class="messagesred">*</td>
                        <td height="28" align="left" valign="middle" >Mobile No.</td>
                        <td align="center" >:</td>
                        <td colspan="2" align="left" valign="middle" >
                            <input name="mobile" class="validate[required,custom[phone]] textbox" id="mobile" value="<%=mobno%>"  maxlength="20"  style="width:120px;" />       </td>
                    </tr>
                    <tr>
                        <td align="center" class="messagesred">*</td>
                        <td height="28" align="left" valign="middle" >Email</td>
                        <td align="center" >:</td>
                        <td colspan="2" align="left" valign="middle" ><font size="2" face="Arial, Helvetica, sans-serif">
                                <input name="job_seeker_email" id="job_seeker_email" type="text" class="validate[required,custom[email]] textbox" value="<%=email%>"  style="width:120px;" />
                            </font></td>
                    </tr>

                </table></td>
        </tr>
        <tr>
            <td align="center" valign="middle">&nbsp;</td>
        </tr>
        <tr>
            <td height="28" colspan="2" align="center" class="messagesred"><input type="submit" name="Submit" value="Update" class="button2"/></td>
        </tr>
        <tr>
          <td align="center" valign="middle">&nbsp;</td>
        </tr>
    </table>
</form>
                                <%
 } catch (Exception e) {
     out.println(e);
            }finally{
                st.close();
                con.close();
            }

%>
<%@include file="footer.jsp" %>